package com.kinoshita.common.logger;


import com.kinoshita.common.status.OpCode;
import com.kinoshita.common.status.StatusCode;
import org.springframework.stereotype.Component;

/**
 *
 */
@Component
public class LoggerUtil {

    private int opCode;

    private String source;

    private String message;

    private String remark;

    private String author;

    public void setInfo(String source,  OpCode opCode, String author, String remark) {
        this.source = source;
        this.opCode = opCode.getCode();
        this.message = opCode.getMsg();
        this.remark = remark;
        this.author = author;
    }
    public void setInfo(String source, StatusCode statusCode, String author, String remark) {
        this.source = source;
        this.opCode = statusCode.getCode();
        this.message = statusCode.getMsg();
        this.remark = remark;
        this.author = author;
    }

    @Override
    public String toString() {
        StringBuilder info = new StringBuilder("");
        info.append("Source")
                .append("[")
                .append(this.source)
                .append("]")
                .append("OpCdoe")
                .append("(")
                .append(this.opCode)
                .append(")")
                .append("==>")
                .append(this.message)
                .append("{")
                .append(this.remark)
                .append("}")
                .append("操作人:")
                .append(this.author);
        return info.toString();
    }

}

